package com.dooioo.fangyou.dao;

import java.util.List;
import java.util.Map;

/**
 * 数据库查询统一接口
 * User: kqy
 * Date: 2010-11-30
 * Time: 14:36:58
 */
public interface QueryDao<T> {
    //单条处理
    public <T> T queryForObject(String sqlId);
    public <T> T queryForObject(String sqlId, Map<String, Object> bindParams);
    public <T> T queryForObject(String sqlId, T entityObject);

    public Map<String, Object> queryForMap(String sqlId);
    public Map<String, Object> queryForMap(String sqlId, Map<String, Object> bindParams);
    public Map<String, Object> queryForMap(String sqlId, T entityObject);
    public Map<String, Object> queryForMap(String sqlId, Map<String, Object> bindParams, T entityObject);

    //数组处理
    public <T> T[] queryForArray(String sqlId);
    public <T> T[] queryForArray(String sqlId, Map<String, Object> bindParams);
    public <T> T[] queryForArray(String sqlId, T entityObject);
    public <T> T[] queryForArray(String sqlId, Map<String, Object> bindParams, T entityObject);

    public <E> E[] queryForArray(String sqlId, Map<String, Object> bindParams, T entityObject, int beginIndex, int maxCount);
    public <E> E[] queryForArray(String sqlId, T entityObject, int beginIndex, int maxCount);

    public Map<String, Object>[] queryForMapArray(String sqlId);
    public Map<String, Object>[] queryForMapArray(String sqlId, Map<String, Object> bindParams);
    public Map<String, Object>[] queryForMapArray(String sqlId, T entityObject);
    public Map<String, Object>[] queryForMapArray(String sqlId,  Map<String, Object> bindParams, int beginIndex, int maxCount);

    public <T> List<T> queryForList(String sqlId);
    public <T> List<T> queryForList(String sqlId, Map<String, Object> bindParams);
    public <T> List<T> queryForList(String sqlId, T entityObject);
    public <T> List<T> queryForList(String sqlId, Map<String, Object> bindParams, T entityObject);
    public <T> List<T> queryForList(String sqlId, Map<String, Object> bindParams, T entityObject, int beginIndex, int maxCount);

    public List<Map<String, Object>> queryForMapList(String sqlId, Map<String, Object> bindParams);
    public List<Map<String, Object>> queryForMapList(String sqlId, Map<String, Object> bindParams, T entityObject);
    public List<Map<String, Object>> queryForMapList(String sqlId, Map<String, Object> bindParams, int beginIndex, int maxCount);

    public int insert(String sqlId, T entityObject);
    public int insert(String sqlId, Map<String, Object> bindParams);
    
    public int update(String sqlId, T entityObject);
    public int update(String sqlId, Map<String, Object> bindParams);

    public int delete(String sqlId, String id);
    public int delete(String sqlId, Map<String, Object> bindParams);
}
